HDX = (X1 - X0) / W
HDY = (Y1 - Y0) / W
VDX = (X3 - X0) / H
VDY = (Y3 - Y0) / H
HDDX = [ (X2- X3) - (X1 - X0)] / (WH) = (HDX1 - HDX0) / H
HDDY = [ (Y2- Y3) - (Y1 - Y0)] / (WH) = (HDY1 - HDY0) / H
Working with Cels Efficiently
To work with cels efficiently, keep in mind the following: 
DrawCels() only once by working with cel lists if possible, as discussed in Chapter 2, "Displaying Cels."
MapCel() can became a CPU bottleneck in certain titles. If you are manipulating data with width and height that are powers of 2, you should use the FastMapCel() function from graphics.lib. It operates quite a bit faster than MapCel() since it can use shifts instead of divides and multiplies. 
CenterCCB() centers a cel. This example comes from jsanimation.c. Example 1: Centering a cel
void CenterCCB(CCB *aCCB, Coord aXCenter, Coord aYCenter)
{
    int32 aWidth;
    int32 aHeight;
    int32 aXPos;
    int32 aYPos;
    aWidth = aCCB->ccb_Width;
    aHeight = aCCB->ccb_Height;
    aXPos = aXCenter - aWidth / 2;
    aYPos = aYCenter - aHeight / 2;
    MoveCCB(aCCB, aXPos, aYPos);
}