As Ed showed in his excellent picture, it is vital to visualize how the geometry works & make sure when you put wood in a miter saw (or SS) that you know which edge is the outside - so you don't cut the 45 deg the wrong way. if the object that you are framing around has long side A, short side B, and the width of your framing material is C, then:
Long side of frame: Outside is A + 2 times C. Inside length is A
Short side of frame: outside is B + 2 times C. Inside length is B
I attached a chart with various widths of framing material as an example.
In general I cut things slightly long & use the disc sander to sneak up on a good fit. Also, as was mentioned, a good suggestion is to cut a practice frame out of scrap. (make sure the scrap pieces are straight).
if your SS or miter saw is in good alignment, the corners will fit snugly. Other problems than alignment are not cleaning wood chips out of the way (a small chip on the fence or miter will really mess up the angles), wood that is not straight, flex of the framing material when it is being cut, etc.
