Any way to rotate a display through scripts?

I’m looking for some way to make a script I could invoke to rotate my display. I’ve crawled through QDBusViewer and looked through KWin and PlasmaShell scripting but I haven’t found anything that seemed to help. Maybe I’ve just missed it, but I can’t find a way to acheive this.

Is there any way to do this currently?

Yes, kscreen-doctor can do that

From kscreen-doctor --help:

-o, --outputs Show outputs

Set rotation (possible values: none, left, right, inverted)
$ kscreen-doctor output.HDMI-2.rotation.left

Not sure how I didn’t think the check for any kscreen executables. That works perfectly, thank you