Blender Shader Node interpolation
you can get the result you want by plugging the generated texture coordinates from the vertex positions of your cube in the Texture Coordinate node instead of the Geometry node.
Here's the result :