1 - Measure at both the top and bottom for width.
2 - Measure at the left and right sides for height.
If it is a tall or wide opening measure at intervals and at least in the middle of each side.
So far so good. But how do you know that it is a rectangle rather than a parallelogram? Measure the diagonals – bottom left to top right and top left to bottom right. If these measurements are equal or +/- 5mm you can consider the opening to be a rectangle.
With bigger variations you may set out the cartoon using the measurements for the opening. Still, you need to know where the right angles are, if there are any, to be able to set out the cartoon to properly fit the opening.
So you may wish to take a template of the opening.