Split any shape into rectangles

Hello
it could be possible but it could be better if you give more information on the “complex shape”
Are the curves parallel ?
is there a tolerance ?
A min rectangle size ?
What to do with parts not transformed to rectangle ?

Post some files …
and look at theses link