Tiled texture on a sprite

Hi!

How to configure a sprite to show a tiled texture?

Example:

A sprite is 200x200, but the texture is 40x40, so it will be shown in 5 lines and 5 columns.

I want to be able to choose the size of the sprite, and how the texture is tiled (how many lines and columns).

Thanks.

Jose