That was going to be my next question, how do i do that within the software ?
That depends on exactly what you want to do.
MAME will auto rotate if you set that in the mame.ini file.
That will leave your front end sideways in portrait mode though.
Depending on which video card you have, you can rotate the entire desktop, and all apps, using the control panel for your video card.
That will let you go back and forth between the two modes, and you can set a hot key to do it with most of the control panels.
The only problem is that it may mess up your front end by squishing it in the one direction, or stretching it in the other.
Lastly, you could set up two versions of your front end, one for vertical, and one for horizontal.
That would make it a pain to switch on the fly, but would limit the games available for each mode.