Example : Rotate a knife that takes 3 squares in height in your inventory so it's now 3 squares in width.
Put it in your hotbar, take it, and when you try to put it back in, the server (or i don't know what) still thinks it's 3 squares in height so it won't go back if you have 3 squares in height of empty space in your inventory.
So basically when you rotate an item from height to width, the hotbar doesn't register the change (Same for width to height). So you have to rotate it back.
Sorry for my english there i'm french i tried to do my best.