move_tile_in_atlas makes tiles disappear

Godot Version

Godot_v4.3-stable_win64

Question

I want to dynamically modify the appearance of tiles in a tileset by changing their atlas coordinates. Basically, I want an animated tile that I can control the appearance of programmatically.

The code for my tilemap looks like this:

extends TileMapLayer

var my_tileset = get_tile_set()
var my_atlas = my_tileset.get_source(0)

func _ready() -> void:
	print("Has room for tile at 3,0? ", my_atlas.has_room_for_tile(Vector2i(3, 0), Vector2i(1, 1), 1, Vector2i(0, 0), 1, Vector2i(-1, -1))) #Returns true
	
	my_atlas.move_tile_in_atlas(Vector2i(0, 0), Vector2i(3, 0), Vector2i(-1, -1)) #Causes tile to disappear

The move_tile_in_atlas function makes the tile at atlas coordinate 0,0 disappear despite the fact that there is room for the tile at the new location according to the has_room_for_tile function. The new location is within my texture and is not already being used by another tile. (In fact, if it were, the function would do nothing and the tile would not disappear.)

What am I doing wrong? How should I be using the move_tile_in_atlas function?