Hmm try this approach for calculating the region of interest depending on the fact that you have four points in the following order: topleft, topright, bottomright, bottomleft.
- Pick the top left as starting point.
- Then calculate an average y coordinate based on Point 1 and Point 2.
- Use the x of the top right together with the first average x.
- Calculate an average x using Point 2 and Point 3.
- Use the y of point 3 together with the average xas third point.
- Use the y of point 3 together with the x of point 4 to define the last point.
- Calculate width and heigth from this set.
- Set a region of interest.
Then use this region of interest for whatever processing you should need it.