// Draws a sub region of this texture on to the specified rectangle.
  public void draw(GLCanvas canvas, RectF source, RectF target) {
    RectF src = mSrcRect;
    RectF dest = mDestRect;
    float x0 = source.left;
    float y0 = source.top;
    float x = target.left;
    float y = target.top;
    float scaleX = target.width() / source.width();
    float scaleY = target.height() / source.height();

    synchronized (mTiles) {
      for (int i = 0, n = mTiles.length; i < n; ++i) {
        Tile t = mTiles[i];
        src.set(0, 0, t.contentWidth, t.contentHeight);
        src.offset(t.offsetX, t.offsetY);
        if (!src.intersect(source)) continue;
        mapRect(dest, src, x0, y0, x, y, scaleX, scaleY);
        src.offset(BORDER_SIZE - t.offsetX, BORDER_SIZE - t.offsetY);
        canvas.drawTexture(t, src, dest);
      }
    }
  }