You have to account for two distortions, and the image will always look a little off if you're not looking at it exactly straight on.
First you need to account for the curve of the glass. Since glass is an inverted truncated cone use the diameter of the cup about where the middle of the design would be. Easiest way to do that would be to take a string and wrap it around the cup where the design will be, that will get you the circumference. Divide that number by Pi, 3.14, to get the Diameter to use in the equation below.
H = h/w*D*sin(w/D)
h - height of image
w - width of image
D - diameter of cup
H - new height for image
And here is a discussion on how to account for the tapered shape of the glass which includes a spreadsheet to do the math so you can create a template.
Even with all this, there's still can be a bit of experimentation to get the design perfect but I've been pretty pleased with my results.