Rotate image in 90° increments

Yes, 180 deg one I know. I needed the portrait style aspect ratio to see the vertical image of the person visiting, which will also show me packages delivered. One of the suggestion was to just rotate the cam 90 deg and watch the stream in full screen. I tried that, worked, but person detection doesnt work in that setup, which is expected.

Surprisingly, in some cases, it still recognizes the person, even after 90 deg rotated. It might be 30-50% accurate, though.