I have a 4 side polygon that i draw on a video frame. I would like to take this polygon and make it a rectangle so i will be able to treat it as a matrix.I want to take the smallest rectangle i can have but still be as close as i can to the original vertices. Can anyone help me with that please? I've been trying to do it for a several days and with no success. Keep in mind that my polygon can be completely not parallel to the axes and in that case i want to get a rectangle that is also not parallel to the axes.