Yea, what API are you using?

OpenGL provides the very convenient

glOrtho() command which does all this for you.