Measure the width of the window opening between the two upper corners.
Transfer the measurement to the bottom edge of a piece of flat wood trim, with two marks on the wood and the measured span between them
Lay the trim on your miter saw, with the front side facing up and the bottom edge against the saw's fence, so it is facing the blade. Slide it so one of the marks is under the blade. Turn the blade to point 45 degrees outward, away from the trim. Make the cut.
Slide the trim to where the second mark is under the blade. Swivel the blade in the opposite direction as before, so it points 45 degrees outward, and make the cut.
Hold the trim along the upper edge of the window opening, so the two mitered ends angle out and up from the two top corners. Secure the piece with your trim nailer, shooting nails every 10 inches or so along the top and bottom edges of the piece of trim.
Measure and cut trim for the remaining three sides of the opening in the same manner. Butt the mitered ends to each other as you nail them, to make the corners. Caulk the perimeter.