grabScreen() not grabbing rotated screen

Hi! While trying to take a screenshot I’m facing some trouble.
This code works fine when calling it:

screenshot.grabScreen(0, 0 , 1080, 1920);
screenshot.save("screenshot.png");
screenshot.clear();

But when I rotate my project by editing main.cpp and adding

ofSetOrientation(OF_ORIENTATION_90_LEFT);

…i get some kind of distorted image that is mostly transparent.
Is there something that I’m missing or a way to fix that?

RPi4B+, 8GB RAM, 16GB microSD with fresh RaspberryOS Lite, app called with sudo startx ./myProject -- -s off

Not a fix, but a workaround.

Wrap the draw() function with matrix:

void ofApp::draw(){
  ofPushMatrix();
  ofRotateZ(-90);
  ofTranslate(-ofGetViewportHeight(),0,0);


  //...
  //draw stuff here
  //...


  ofPopMatrix();
}

Take screenshot and rotate it before saving:

screenshot.grabScreen(0, 0 , 1920, 1080);
screenshot.rotate90(1);
screenshot.save("screenshots/screenshot.png");
screenshot.clear();