easy
the hitbox that youre seeing is the one that rotates with the cube. this one means nothing. it is purely visual.
there is also another square hitbox that doesnt rotate. this one seems to be invisible. this one actually counts as a real hitbox.
so in conclusion, your real hitbox collided with the spike.