A Poincaré–Birkhoff theorem for Hamiltonian flows on nonconvex domains