Those are caused by subpixel interpolation. Select your shape layer and press the u key twice to reveal all of the modified properties of your shape then fix the size and position of your shape so that everything is a whole number. If your rectangle is an odd number of pixels high or wide then the anchor point value must.be at a half pixel. IOW if the rectangle is 51 x 100 the anchor point must be sent to 25.5, 50.
Once you start animating position the anti-aliasing will take over again but this usually causes no problems because you cannot judge the quality of your video from a single frame, you have to make your judgment call when the video is playing at speed and full-size on the device you intend to use to present your video. And other words you can't tell if your project is perfect unless you watch it on television if it is intended for television or on a computer monitor if it is intended for YouTube.
Great thanks for that Rick, that is going to be a lot easier than the way I was going to solve it