So I accidentally tilted a laptop (HP ZBook) under Gnome Shell (Debian Stretch), and to my surprise the screen rotated automatically, so I have portrait 1080x1920 now. Funnily, I can tilt the laptop to the opposite side, and the system performs a 180 degree rotation. Only, the sensor or the software doesn't detect when I tilt back to normal, so I'm stuck with a 90 degree rotated portrait format.
Gnome display preferences doesn't have any rotation option, and xrandr doesn't indicate that the screen is rotated. How do I fix this?
Note that reboot solved it, but I would like to know how I can get back to unrotated screen in a live session if this happens again.