UI not rotated according monitor

I use my monitor rotated to 270° and sometimes the UI starts to behave weirdly. 

At the attached picture you can see that the top bar is how it's supposed to be, but everything else is rotated.

At the video I'm trying to close the program by right clicking the dock icon and it rotates like that. That's the second time it happens and just by unplugging the monitor and plugging it again solved the issue.

I'm using a 14" MacBook Pro with M2 Pro chip and a Dell P2422H monitor connected using a USB-C Digital AV Multiport Adapter


Upload ID: 2023_08_25_fdpGNAMRtcs9BFYv81EgTT