I tried that, and it gets me part way there, but the internals of the WordPress index.php come into play to prevent this being a solution.
1. WordPress wants the "Page" name to come last, so I followed your suggestion, but with "app" moved to the end.
Same idea as your rule, but rearranged. See .htaccess appended below.
2. The REQUEST_URI is "alpha/beta/app", and the QUERY_STRING "p1=alpha&p2=beta", ...
but the WordPress index.php comes into play and seems to do a REDIRECT (so my app never gets a chance to run)
so that REQUEST_URI becomes "app" and QUERY_STRING is empty. My app code runs, but now it is too late; the parameters are gone.
Any further suggestions?
# .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/app$ /app/?p1=$1&p2=$2 [QSA,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress