Did you output the origin immediately after changing it?
If not, then it's being changed back somewhere else, but if so, there is something wrong.
First, try placing the output immediately after to confirm it's actually getting changed as expected then, either move that output further away and find out when it changes, or try to use your debugger to step through it.
Is pieceShape a sprite, rectangle, or a container class with those things in it?
If it's a container class, you might have to get the local bounds of its internal element for the origin.