I scale it the following way:
float dx = texture.getImageWidth() / (float) d1;
float dy = texture.getImageHeight() / (float) d1;
float fx = texture.getWidth();
float fy = texture.getHeight();
glBegin(GL_QUADS);
glTexCoord2f(i*fx/dx, j*fy/dy);
glVertex2i(x,y);
glTexCoord2f((i+1)*fx/dx, j*fy/dy);
glVertex2i(x+d2,y);
glTexCoord2f((i+1)*fx/dx, (j+1)*fy/dy);
glVertex2i(x+d2,y+d2);
glTexCoord2f(i*fx/dx, (j+1)*fy/dy);
glVertex2i(x,y+d2);
glEnd();
A tile is d1xd1 pixel in the image i load, and it should be d2xd2 pixel on the screen
since d1 = 16 and d2 = 32, which are powers of 2, i don't think that there should be any floating point imprecision