### 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)

ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters", PROPERTY_HINT_RANGE, "-1,128000,1"), "set_visible_characters", "get_visible_characters");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_characters_behavior", PROPERTY_HINT_ENUM, "Characters Before Shaping,Characters After Shaping,Glyphs (Layout Direction),Glyphs (Left-to-Right),Glyphs (Right-to-Left)"), "set_visible_characters_behavior", "get_visible_characters_behavior");
	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "visible_ratio", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_visible_ratio", "get_visible_ratio");
	ADD_GROUP("BiDi", "");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "text_direction", PROPERTY_HINT_ENUM, "Auto,Left-to-Right,Right-to-Left,Inherited"), "set_text_direction", "get_text_direction");
	ADD_PROPERTY(PropertyInfo(Variant::STRING, "language", PROPERTY_HINT_LOCALE_ID, ""), "set_language", "get_language");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "structured_text_bidi_override", PROPERTY_HINT_ENUM, "Default,URI,File,Email,List,None,Custom"), "set_structured_text_bidi_override", "get_structured_text_bidi_override");
	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "structured_text_bidi_override_options"), "set_structured_text_bidi_override_options", "get_structured_text_bidi_override_options");
	ADD_SIGNAL(MethodInfo("meta_clicked", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
	ADD_SIGNAL(MethodInfo("meta_hover_started", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
	ADD_SIGNAL(MethodInfo("meta_hover_ended", PropertyInfo(Variant::NIL, "meta", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
	ADD_SIGNAL(MethodInfo("finished"));
	BIND_ENUM_CONSTANT(LIST_NUMBERS);
	BIND_ENUM_CONSTANT(LIST_LETTERS);
	BIND_ENUM_CONSTANT(LIST_ROMAN);
	BIND_ENUM_CONSTANT(LIST_DOTS);
	BIND_ENUM_CONSTANT(MENU_COPY);
	BIND_ENUM_CONSTANT(MENU_SELECT_ALL);
	BIND_ENUM_CONSTANT(MENU_MAX);
	BIND_BITFIELD_FLAG(UPDATE_TEXTURE);
	BIND_BITFIELD_FLAG(UPDATE_SIZE);
	BIND_BITFIELD_FLAG(UPDATE_COLOR);
	BIND_BITFIELD_FLAG(UPDATE_ALIGNMENT);
	BIND_BITFIELD_FLAG(UPDATE_REGION);
	BIND_BITFIELD_FLAG(UPDATE_PAD);
	BIND_BITFIELD_FLAG(UPDATE_TOOLTIP);
	BIND_BITFIELD_FLAG(UPDATE_WIDTH_IN_PERCENT);
	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, RichTextLabel, normal_style, "normal");
	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, RichTextLabel, focus_style, "focus");
	BIND_THEME_ITEM_EXT(Theme::DATA_TYPE_STYLEBOX, RichTextLabel, progress_bg_style, "background", "ProgressBar");