In this paper we continue the investigation of partition functions of
critical systems on a rectangle initiated in [R. Bondesan et al,
Nucl.Phys.B862:553-575,2012]. Here we develop a general formalism of rectangle
boundary states using conformal field theory, adapted to describe geometries
supporting different boundary conditions. We discuss the computation of
rectangular amplitudes and their modular properties, presenting explicit
results for the case of free theories. In a second part of the paper we focus
on applications to loop models, discussing in details lattice discretizations
using both numerical and analytical calculations. These results allow to
interpret geometrically conformal blocks, and as an application we derive new
probability formulas for self-avoiding walks.Comment: 46 page