The effective chiral Lagrangian from the theta term