Adjustment of window length with sliding/moving RMS method for frequency drifts
You're right that when you're using this method to calculate the RMS value of a sinusoid, it's sensitive to getting an integer number of periods of that sinusoid in the observation window. I can see a couple ways to tweak your approach:


Since it's important to get full periods into your estimate, you could add some tracking of the sinusoid's frequency and phase. In the most complicated implementation, this could be a full-blown phase-locked loop. I've seen embedded RMS measurement systems before where this approach is used. Basically, you create  a PLL that is locked to your input signal, then use the locked phase and frequency to ensure you take samples across as close to an integer number of periods as you can.

A somewhat simpler way of doing this is as follows: consider processing datasets like those you plotted above. If the data should have approximately one period of the signal, then you can get a finer estimate of the period by locating the sinusoid's zero crossings. Once you've estimated the period, then you can use that subset of the data for your RMS calculation. This might be sufficient, depending upon the accuracy that your application requires.
Thinking a bit outside the box: is the input signal a very pure sinusoid (with negligible noise), and is it always significantly oversampled? You could dispense with the RMS approach altogether and simply look for peak amplitude, then use this to calculate the sinusoid's RMS level.