Screen stuck rotated at 90 degrees

I recently installed macOS 12 on my laptop, but the screen has been stuck rotated vertically. I managed to change a setting in the config to make it rotate normally in the efi, but it won’t work in macos. Strangely, it shows that the resolution is 800x1280, not 1820x800. I’ve tried lots of different tools to rotate the monitor, but nothing works. How can I fix this?

Edit: It also displays at having 0 Hz, but behaves like 60Hz. I would want to try setting it to 90Hz (The max Hz), but it doesn’t give me the option to change it