I just checked and both MAME 2010 and newer have the option to block rotation.
In fact, I was able to successfully control the rotation only through the shader. Thanks everyone for that!
But, I noticed that by default, in the latest Mame the game opens vertically, filling the entire screen. In Mame 2010 the same game runs horizontally, also filling the entire screen. However, in the latest Mame version, when applying the shader, everything automatically goes in its place, without needing to adjust the shader parameters. I don’t know if this is true for all games. So far I’m just testing these two games that appeared in my screenshots.
I’m glad I can still use my selective romset. Thanks @HyperspaceMadness , @Duimon and @hunterk !