Completely failed to work out what was necessary
But by playing around with VSTRETCH and VPOS in the Slider Controls menu I've found that I can cleanstretch the vertical manually (using TNZS as an example, disable cleanstretch, set the VSTRETCH to 0.932 and the VPOS to 0.002 and it's perfect). This works fine because we are only ever shrinking the height, we never want to go above the render area - otherwise I could enable cleanstretch and stretch the horizontal manually. The latter would be easier but unfortunately I think I've found a tiny flaw in baseline MAME that Groovy inherits, and now I've spotted it it's bugging the hell out of me.
Set resolution to 640x480, prescale 2, filter 0, cleanstretch 0, keepaspect 1, effect scanlines.png. Run TNZS. Set the vstretch to 0.932 and the vpos 0.002 - this makes the horizontal clean (the scanlines mask any scaling errors, the vpos pushes the error about to be explained into a scanline). Now try and get the vertical to be clean. You can't. There's always one line exactly in the centre of the screen that is doubled. Disable scanlines and you'll see it on the horizontal as well. Setting HSTRETCH to 0.932 should be what's needed but you always get that line, and there's no way of cheating by pushing it into a scanline.
Do exactly the same, but with prescale 0. The errors are gone.
Now, here's the important part as it's where Groovy comes in. Cleanstretch 1, prescale 2. I understand that if cleanstretch is on there should be no need of prescaling, but since we eventually want to enable filtering to eliminate shimmering on horizontal scrolling caused by non-integer X scaling, we definitely need to prescale. Without prescaling we get a lot of undesirable blurring vertically.
Unless I'm very much mistaken, prescaling by 2 and cleanstretching should produce a perfect pixel doubled image. But it doesn't. I'm not sure whether prescale 2 and keepaspect 1 (baseline) should produce a pixel doubled image, but it doesn't anyway.
It's extremely subtle on a big CRT once scanlines and filtering is enabled - an LCD just highlighted the issue to me as I was trying to write up a tutorial