@T0biasCZe I actually am looking into this same thing. I was able to successfully rotate the screen 90 degrees for only the desmume emulator everything else stays horizontal, however the touch screen doesn't work.(my issue with it) I have not been able to figure out how to get drastic to flip vertically as it does work with a touchscreen. I have an image of what my desmume looks like with the change.
You will want to access the NDS folder and look for retroarch config file. retropie/configs/nds/retroarch.cfg. This will load an override config for the NDS emulator when it launches. Next you will want to edit it. I connect with Windows and make the change in Notepad++. You will want to add the line line video_rotation = "1" or video_rotation = "3" above the #include line. That should turn your screen the other way.
Another way it could be edited is to go in through the Retropie settings and choose Retroarch. Once there settings -> video-> output-> video rotation. after you make the change here go back to the rtroarch main menu you should see the configuration file. save as new config. You should be able to use that new file in place of the retroarch.cfg.
For me it only listened to the keyboard input by default, I was able to remap the game keys to the joypad however, so that much is good. The select+start and select+x didn't work on Desume either, which has libretro support as far as I can see.
Turns out changing the settings for DraStic was barely even required. Where the game was completely unplayable on the default settings for Desmume, it works nearly perfectly with DraStic on default settings.