yes, take a look at the ultrastik360 plugin which runs commands whenever a game is launched and whenever it ends. You could tweak it a bit to do what you are looking for.
To figure out the rotation of a game from a script, use fe.game_info( Info.Rotation )
. It will equal "90" or "270" for vertical games, "0" for horizontal.
cheers