Returns a crop of `img` based on a sequence number `tile_number`.

    :param int tile_number: Number of the tile between 0 and `max_tiles`^2.
    :raises TileOutOfBoundsError: When `tile_number` exceeds `max_tiles`^2
    :rtype PIL.Image:

def get_tile(tile_number):
    """
    Returns a crop of `img` based on a sequence number `tile_number`.

    :param int tile_number: Number of the tile between 0 and `max_tiles`^2.
    :raises TileOutOfBoundsError: When `tile_number` exceeds `max_tiles`^2
    :rtype PIL.Image:
    """
    tile_number = int(tile_number)
    max_tiles = app.max_tiles
    if tile_number > max_tiles * max_tiles:
        raise TileOutOfBoundsError('Requested an out of bounds tile')

    tile_size = Point(
        app.img.size[0] // max_tiles, app.img.size[1] // max_tiles)
    tile_coords = Point(
        tile_number % max_tiles, tile_number // max_tiles)
    crop_box = (
        tile_coords.x * tile_size.x,
        tile_coords.y * tile_size.y,
        tile_coords.x * tile_size.x + tile_size.x,
        tile_coords.y * tile_size.y + tile_size.y,
    )
    return app.img.crop(crop_box)