"If the E-field is not perpendicular to the surface area, then the flux will be less than EA because less electric field lines will penetrate A. Consider the wedge shape surface below. The electric field lines are perpendicular to the surface area A' but not to A.

Since the same number of electric field lines cross both surfaces, the flux must be the same through both surfaces."

Clearly, the surface A is not perpendicular to the electric field, but surface A' is. So, the number of electric fields lines passing through A should be less than the number passing through A', as they suggest in the passage before the picture. Yet, they go on to say that the number of electric fields lines passing though each surface is the same. What is going on?

-

It is a misleading diagram due to the way the field lines are drawn and the way angle is defined. The angled surface has actually increased in Area, thereby inadvertently keeping the flux the same. The usual definition is that $\theta$ is zero when E and the surface are perpendicular.

$\theta=0$ , flux is proportional to A

$\theta\ne0$, flux is proportional to $A\cos\theta$ until the field lines and surface are parallel ($A\cos90=0$)

This is a better (although somewhat exaggerated and not as pretty picture): Flux through a surface at an angle

-