To remove the keystone distortion I use some commands available in ImageMagick. I wrote some Unix scripts which are not too user-friendly for the general public.
convert $INPUT1 -matte +distort Perspective "296,461 0,0 325,4721 0,5184 2978,693 3456,0 3016,4446 3456,5184" $OUTPUT1
convert $INPUT2 -matte +distort Perspective "306,554 0,0 328,4421 0,5184 2906,687 3456,0 2922,4280 3456,5184" $OUTPUT2
convert $INPUT3 -matte +distort Perspective "353,639 0,0 325,4582 0,5184 3118,675 3456,0 3116,4584 3456,5184" $OUTPUT3
convert $INPUT4 -matte +distort Perspective "349,641 0,0 309,4616 0,5184 3210,549 3456,0 3192,4778 3456,5184" $OUTPUT4
convert $INPUT5 -matte +distort Perspective "300,683 0,0 263,4641 0,5184 3130,471 3456,0 3111,4921 3456,5184" $OUTPUT5
When I take a photoshoot, I usually take a picture of a rectangle and use it as a reference for later. I think you can do the same in After Effect but I haven't tried.
For Macro I don't correct the keystone distortion. People never see insects so close and they cannot detect distortions, or they are more acceptable.
And here is a more complex design with Blender.