Split a polygon composed of multiples of 90 degree angles into rectangles?

Not sure if this is what I’m looking for as it accounts for holes which afaik shouldn’t be possible if a user is manually placing points.

I came across this post which was what I was looking for in essence, and I think this reply might be exactly what I’m looking for since the vertices will be placed in a CW or CCW order:

I’m going to sleep now and probably come up with something tomorrow but I’ll send an update if I have any updates.