Opencv python irregular square detection

I tried template matching but it didn’t work.