If you have found or can see that the opening is not a true rectangle and cannot determine where any right angles are, you need to take a template.
The objective is to make a piece that will fit into the opening without bending or being too small for the space. It will be the same size as the finished panel and so you will be able to put the finished panel into the opening without needing to trim or expand the panel.
First, trim the sheet of material you have chosen to use to a size a little larger than the measured size. Place the uncut side along one of the long sides of the opening. If the opening is a portrait format, place it on the right or left side as convenient to you.
Next, adjust the bottom by marking a line on the sheet. This is where a second person is very useful. One person can hold the sheet in place on outside of the opening and the other do the marking from the inside –in the case of the rebate being on the outside and vice versa if the rebate is on the inside. The marked line should be as close to the edge of the rebate as possible. The special case of an opening in stone will be dealt with separately.
Then take the sheet to a place where it can be safely cut. A long metal straight edge and craft or “Stanley” knife are often the best aids to cutting straight lines. Replace the sheet into the opening after cutting, and make any adjustments to the size and angles of the sheet at the bottom by marking and cutting as necessary.
When the side and bottom are adjusted, start on the other side. Proceed as for the bottom.
When the side is finished, start on the top.
Finally, present the whole sheet to the opening to make sure it slips into place with no snags, or bending of the sheet.
It may be that the opening is too large for a single sheet. In that case you will need to work with two or more sheets and try them together for the final fitting into the opening. You can put them together in the window. You can fasten them together with tape or other fasteners to make one sheet. You can also make two parallel lines both at angles and at intervals across the sheet so that when you get back to the studio you can exactly reproduce the full sheet by matching the marks and then firmly fastening them together. This makes transport of large templates much easier.
You will know that a panel made to a template made in this way will fit into the opening, no matter how irregular the opening may be.