it's basically a perspective transform, but it can be tricky to get it to match an effect by just tweaking. For the mode7 effect there's a capx that has the math worked out but it's not too pretty.
A approximation would be to take a snapshot of just the ground with the effect applied. Measure the width in the middle and at the top. Then taking an object's y position you can calculate the scale with:
Scale=lerp(widthtop/widthmid, 1, y/240)
Or instead of 240, half the screen height.