I use JEDI-SDL with OpenGL for my graphics myself and what I do is make a small function to do these calculations for me. Then I make individual functions for grabbing my segment of texture using simple x,y co-ordinates.

The trick is to make functions that will do all the labour intensive stuff for you.