### Estimation of 4-point Polygon in Contour

Hi,
I have some problem with creating algorithm which will be able to create biggest possible.
So far I was only estimating the biggest inscribed Rectangle. Example output:

I want to gave 4-point polygon like this blue:

So far I get following result:

As you can see. I only change left upper corner.

The pseudo-code which done it is following:

```
1.Get all possible Inscribed Square
2. Get all possible Inscribed Rectangle
3.Get biggest Rectangle and write every possible combination of (top left, top right, bottom left, bottom right)
4. Sort them by size and take biggest.
```

In fact, I do not do all all possible permutation, because it will take ages to finish.

Do you maybe face any similar problem or know how to resolve it in finite time?