Remove the trim and measure the rough opening or remove one piece of the trim and measure the thickness of the window frame and incorporate it into the measurement.
Typically the window company will take 1/4" off each of the measurements to give them 1/2" clearance to allow for out of plumb / level issues. In an older house you might want to either just the square / plumb if you are installing or be ready for the installer to have a hard time. Worst case they can shave down the rough opening so that it is a little bigger.
Replacing a window actually has many different factors. Are you doing the install or are you hiring that out? How are you water proofing the rough opening? Is your exterior siding / trim staying as is with some plan to remove it from the existing window frame?
In my climate we use window header flashing (metal pieces on the exterior above the window rough opening) and blue skin on the sill rough opening. These modern best practices are probably ignored in a renovation depending on siding type.