Getting tile numbers from latitude/longitude is easy.View source on this page and see http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames.