Each scenario would require a different formula. It would depend on where the center of the images is, how large an offset you need etc.

Also if you think about it - a formula needs CPU time to calculate - the use of an array like this is just straight memory access and there fore faster (Of course this only applies if you are really worried about every possible Frame you can get )