Hamiltonian gauge theory with corners