Millions of Venezuelans have voted to reject President Nicolas Maduro's controversial plans to rewrite the country's constitution.