It's just a matter of saving the position of one of the objects to some variables and then setting the position of the objects to the other.
global number tempx =0
global number tempy = 0
start of layout
--- set tempx to sprite.x
--- set tempy to sprite.y
--- sprite: set position to (sprite2.x, sprite2.y)
--- sprite2: set position to (tempx, tempy)
For the example of swapping pieces around, i'd assume they are all instances of the same object type.
global number tempx =0
global number tempy = 0
global number iid1=0
global number iid2=0
start of layout
repeat 100 times
--- set iid1 to int(random(sprite.count))
--- set iid2 to int(random(sprite.count))
------ pick sprite instance iid1
--------- set tempx to sprite.x
--------- set tempy to sprite.y
--------- sprite: set position to (sprite(iid2).x, sprite(iid2).y)
------ pick sprite instance iid1
--------- sprite2: set position to (tempx, tempy)