### Godot version

v4.2.rc1.official [ad72de508]

### System information

Godot v4.2.rc1 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)

### Issue description

While trying to use a custom effect script as a workaround for the [rainbow bbcode effect](https://github.com/godotengine/godot/issues/85031) at the RichTextLabel I found a bug regarding the `CharFXTransform.relative_index`.
The variable is explained as follows in the [documentation](https://docs.godotengine.org/en/4.0/classes/class_charfxtransform.html#class-charfxtransform-property-relative-index): 
```
The character offset of the glyph, relative to the current RichTextEffect custom block.
```
However, when using the script below, the character index shifts one to the left each time instead of being at the same position for each new effect block.
![grafik](https://github.com/godotengine/godot/assets/71942164/7b1b0557-d515-4d56-a25e-d2a2810b2966)


### Steps to reproduce

Add this script as Custom Effect to the RichTextLabel (or see the MRP):
```@tool
extends RichTextEffect
class_name test

var bbcode = "test"

func _process_custom_fx(char_fx):
	if char_fx.relative_index == 5:
		char_fx.color = Color.BLACK
	pass
```
Add this Text to a Rich TextLabel:
```
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
``` 

### Minimal reproduction project

[relative_index_issue.zip](https://github.com/godotengine/godot/files/13462368/relative_index_issue.zip)

ClassDB::bind_method(D_METHOD("is_menu_visible"), &RichTextLabel::is_menu_visible);
	ClassDB::bind_method(D_METHOD("menu_option", "option"), &RichTextLabel::menu_option);
	ClassDB::bind_method(D_METHOD("_thread_end"), &RichTextLabel::_thread_end);
#ifndef 
	ClassDB::bind_compatibility_method(D_METHOD("push_font", "font", "font_size"), &RichTextLabel::push_font);
	ClassDB::bind_compatibility_method(D_METHOD("set_table_column_expand", "column", "expand", "ratio"), &RichTextLabel::set_table_column_expand);
#endif // 
	// 
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "bbcode_enabled"), "set_use_bbcode", "is_using_bbcode");
	ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_content"), "set_fit_content", "is_fit_content_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_active"), "set_scroll_active", "is_scroll_active");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_following"), "set_scroll_follow", "is_scroll_following");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "autowrap_mode", PROPERTY_HINT_ENUM, "Off,Arbitrary,Word,Word (Smart)"), "set_autowrap_mode", "get_autowrap_mode");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_size", PROPERTY_HINT_RANGE, "0,24,1"), "set_tab_size", "get_tab_size");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_keys_enabled"), "set_shortcut_keys_enabled", "is_shortcut_keys_enabled");
	ADD_GROUP("Markup", "");
	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "custom_effects", PROPERTY_HINT_ARRAY_TYPE, MAKE_RESOURCE_TYPE_HINT("RichTextEffect"), (PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE)), "set_effects", "get_effects");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "meta_underlined"), "set_meta_underline", "is_meta_underlined");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hint_underlined"), "set_hint_underline", "is_hint_underlined");
	ADD_GROUP("Threading", "");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "threaded"), "set_threaded", "is_threaded");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "progress_bar_delay", PROPERTY_HINT_NONE, "suffix:ms"), "set_progress_bar_delay", "get_progress_bar_delay");
	ADD_GROUP("Text Selection", "");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selection_enabled"), "set_selection_enabled", "is_selection_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_and_drop_selection_enabled"), "set_drag_and_drop_selection_enabled", "is_drag_and_drop_selection_enabled");
	ADD_GROUP("Displayed Text", "");
	//