### Godot version

v4.1.beta1.official [828ec2c5d]

### System information

Windows 11 Home, v4.1.beta1.official [828ec2c5d], All Renderers, NVidia GeForce RTX 3060 Ti,  Drivers 535.98

### Issue description

When enabling the "Y Sort Enabled" ordering method for a Sprite2D, the sprite will be rendered entirely black.

![grafik](https://github.com/godotengine/godot/assets/29011290/6fa4da16-d9a5-4c3b-a9e4-c1bba53c2183)
![grafik](https://github.com/godotengine/godot/assets/29011290/cbf499ae-f3f7-4c07-98b2-a1a667d810c2)


### Steps to reproduce

Simply create a Sprite2D Node, assign any texture to it and activate Y-Sorting

### Minimal reproduction project

[GDB_4.1_ysort.zip](https://github.com/godotengine/godot/files/11704361/GDB_4.1_ysort.zip)

if (i < p_colors.size()) {
				color = p_colors[i];
				color2 = Color(color.r, color.g, color.b, 0);
			}
			colors_ptr[j + 0] = color;
			colors_ptr[j + 1] = color;
			colors_left_ptr[j + 0] = color;
			colors_left_ptr[j + 1] = color2;
			colors_right_ptr[j + 0] = color;
			colors_right_ptr[j + 1] = color2;
			if (is_first_point && !loop) {
				Vector2 begin_border = -segment_dir * border_size;
				points_ptr[0] = pos + edge_offset + begin_border;
				points_ptr[1] = pos - edge_offset + begin_border;
				colors_ptr[0] = color2;
				colors_ptr[1] = color2;
				points_left_ptr[0] = pos + edge_offset + begin_border;
				points_left_ptr[1] = pos + edge_offset + begin_border + border;
				colors_left_ptr[0] = color2;
				colors_left_ptr[1] = color2;
				points_right_ptr[0] = pos - edge_offset + begin_border;
				points_right_ptr[1] = pos - edge_offset + begin_border - border;
				colors_right_ptr[0] = color2;
				colors_right_ptr[1] = color2;
			}
			if (is_last_point && !loop) {
				Vector2 end_border = prev_segment_dir * border_size;
				int end_index = polyline_point_count + 2;
				points_ptr[end_index + 0] = pos + edge_offset + end_border;
				points_ptr[end_index + 1] = pos - edge_offset + end_border;