A motion to quash shall be in writing, signed by the defendant or his attorney, and filed in open court or in the office of the clerk of court. It shall specify distinctly the grounds on which it is based. The court shall hear no objection based on grounds not stated in the motion.