If I understand what you want to achieve...
This is where angles get a little tricky. 🙂
rotation_degrees is an euler angle, made of pitch, yaw and roll. It's true that doing -camera.rotation_degrees would give the opposite rotation.
But that only works if small_cube and camera aren't in a hierarchy together (like one the child of the other). The reason is euler angles of nodes in Godot aren't added to their parent's euler angles. So a parent with (20,10,0) and a child of (-20,-10,0) don't cancel out. The euler angles are converted to basis vectors (effectively matrix maths) and multiplied together.
What this means is not only do you need to do the opposite rotation (like (-20,-10,0)) but the order of combining pitch, yaw and roll must be reversed as well.
The best way to not have to worry about euler orders and stuff is to use Quaternions (a whole other bag of worms, but useful in this situation). You can read the orientation of the parent into a Quaternion, do the true inverse rotation and apply it to the child node. That will cancel out the parents rotation.
I made a child spatial node of the orbit camera spatial node and put a mesh child on it. On the child I added this function:
func _process(delta):
var q = Quat(get_parent().transform.basis)
transform.basis = Basis(q.inverse())
That reads the parent's rotation from transform.basis into a quaternion, inverts it and puts it into the child's transform.basis.
So I've got a little cube in the upper right that works like the Godot XYZ gizmo thing.
In your code, it should work if you replaced this line:
small_cube.rotation_degrees = - camera.rotation_degrees
with this:
var q = Quat(camera.transform.basis)
small_cube.transform.basis = Basis(q.inverse())
Edit: oh, forgot to mention that transform.basis isn't just the rotation, it's the scale too. Turning it into a quaternion and back will reset the scale to 1,1,1. So if you want the cube scaled, scale a child of the small_cube node instead, otherwise you'll need to manually scale it back each frame in the code.
The position is fine, that's separate in transform.origin.