get_used_rect() will return the full rectangle in tile space. For example, if you have a map that is 10 tiles wide and 10 tiles tall, you’ll get (0, 0, 10, 10). You then need to convert these into pixel space using map_to_world():
var tile_rect = $TileMap.get_used_rect()
var topleft = $TileMap.map_to_world(tile_rect.position)
var size = $TileMap.map_to_world(tile_rect.size)
If the TileMap is moved, you also need to add its position to place your TextureRect:
This works well for square tiles. It gets a bit more complicated for hex or isometric tiles.
Ah, that must be why I’m having difficulty. I’m using Isometric tiles. Can you explain how I would go about calculating the proper size for the TextureRect from an isometric grid?