As said before, the rattling is the camera, not the vibrate motor or switch. All iPhone 4s have this problem, but the degree varies. If you opt to go with a replacement phone, you're only going to end up with the same problem.
See here: https://forums.macrumors.com/threads/992481/
See here: https://forums.macrumors.com/threads/992481/