I recently upgraded my Lenovo Ideapad Miix 510 from 16.04 to 18.04 and was pleasantly surprised to find that my previously nonfunctional screen autorotation started working with the upgrade. Unfortunately, the autorotation is always 90 degrees counterclockwise relative to the actual orientation of the tablet unless I lock the rotation. Also if I reorient the tablet too frequently without locking the screen rotation, the screen goes solid grey and the whole system hangs.

Settings -> Displays does not have an Orientation or Rotation section, presumably because of autorotation. Using xrandr with -o or --rotate yields 

> 
> Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
> 
> 
> 

Is there a way to leave autorotation enabled, but tell Ubuntu to always present the screen 90 degrees clockwise from what it thinks the orientation should be?