Weakly correlated electrons on a square lattice: Renormalization-group theory